package com.leyou.item.inter.api;

import com.leyou.common.bean.Result;
import com.leyou.common.bean.ServerConstant;
import com.leyou.item.inter.dto.SpecSelectDTO;
import com.leyou.item.inter.fallback.SpecGroupParamServiceFallbackFactory;
import com.leyou.item.inter.pojo.SpecGroup;
import com.leyou.item.inter.pojo.SpecParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zqq
 * @ClassName ISpecGroupParamService
 * @Description
 * @date 2020/3/7-16:36
 */
@Component
@FeignClient(value = ServerConstant.ITEM_SERVICE_ID, fallbackFactory = SpecGroupParamServiceFallbackFactory.class)
public interface ISpecGroupParamService {

    @RequestMapping(value = "/spec/groups/{cid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<SpecGroup>> queryGroupsByCid(@PathVariable("cid")Long cid);

    @RequestMapping(value = "/spec/params", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<SpecParam>> queryParams(@RequestBody SpecSelectDTO dto);

    @RequestMapping(value = "/spec/group/param/{cid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<SpecGroup>> queryGroupsWithParam(@PathVariable("cid") Long cid);
}
